package com.example.beautymakeup.dao;


import com.example.beautymakeup.pojo.Address;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface AddressDao {
    @Select("select * from address where userId = #{userId};")
    List<Address> getByUserId(int userId);

    @Select("select count(*) from address where userId = #{userId};")
    int getCount(int userId);

    @Select("select * from address where uid = #{uid};")
    Address getByUid(int uid);

    @Insert("insert into address (userId,name,phone,address) values (#{userId},#{name},#{phone},#{address});")
    int add(Address address);

    @Delete("delete from address where uid = #{uid} and userId = #{userId};")
    int delete(Address address);

    @Update("update address set name = #{name},phone = #{phone},address = #{address} where uid = #{uid} and userId = #{userId};")
    int update(Address address);
}
